package by.jtraining.london.model;

/**
 * @author Irina Pakhomova
 *
 */
public enum Course {
	JAVA_EE("JavaEE"), ASP_NET("ASP.NET") , SFT("SFT");
	
	private String nameCourse;
//	private int id;
	private Course(String name) {
		nameCourse = name;
	}
	
	static public Course getCourse(String name) {
	    for (Course course: Course.values()) {
	        if (course.getCourse().equals(name)) {
	            return course;
	        }
	    }
	    throw new RuntimeException("unknown course");
	}
	static public Course getCourse(int ordinal){
		for (Course course: Course.values()) {
	        if (course.ordinal() == ordinal) {
	            return course;
	        }
	    }
		throw new RuntimeException("unknown course ordinal");
	}
	public int getId(){
		return this.ordinal();
	}
	public String getCourse() {
	    return nameCourse;
	}
}
